Skip to content

fix: revert to shared internal auth token, defer generation until after bind#95

Merged
blaspat merged 1 commit into
mainfrom
fix/shared-token
Jul 20, 2026
Merged

fix: revert to shared internal auth token, defer generation until after bind#95
blaspat merged 1 commit into
mainfrom
fix/shared-token

Conversation

@blaspat

@blaspat blaspat commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Problem

Profile-scoped token files caused auth mismatch: default gateway wrote token A to its path, kate gateway wrote token B to its path. Tools on different profiles got 401.

Fix

  1. _internal_token_path() always returns ~/.hermes/nodes-internal-token — shared across profiles
  2. Token generation moved to AFTER the bind-wait loop in runner.start()
    • If we bound the port (default gateway): generate fresh token
    • If port was occupied (kate profile): read existing shared token
  3. Removed unused import os from tools.py

This restores the pre-auth behavior where one gateway owns port 7000 and all profiles share the transport.

…er bind

Three changes:
1. _internal_token_path() always returns ~/.hermes/nodes-internal-token
   (removes HERMES_HOME profile-scoping) in both wsserver/server.py and tools.py
2. Token generation moved from before _serve() to after the bind-wait loop
   in lifecycle.py — if we bound the port, generate fresh token; if port
   was occupied (kate profile), read the existing shared token.
3. Removed unused 'import os' from tools.py

This fixes the profile collision: default gateway owns port 7000 and
generates the token; kate gateway reads it and authenticates against
the running server.

Signed-off-by: Blasius Patrick <blasius.patrick@gmail.com>
@blaspat
blaspat merged commit 2f1cdbc into main Jul 20, 2026
2 checks passed
@blaspat
blaspat deleted the fix/shared-token branch July 20, 2026 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant